package presenter;

import java.util.List;

import base.BasePresenter;
import base.ResultCallBack;
import bean.InfoSchoolBean;
import bean.InfoSchoolBean2;
import bean.InfoSchoolBean3;
import model.EditInfoModel;
import view.EditInfoView;

/**
 * Created by Windows on 2019/11/5.
 */

public class EditInfoPresenter extends BasePresenter<EditInfoView> {
    private EditInfoModel model;

    public EditInfoPresenter() {
        this.model=new EditInfoModel();
        addModel(model);
    }

    public void requestEditInfo_School() {
        model.requestEditInfo_school(new ResultCallBack<List<InfoSchoolBean>>() {
            @Override
            public void onSuccess(List<InfoSchoolBean> infoschoolBeans) {
                if (mView!=null)
                    mView.onSchoolSuccess(infoschoolBeans);

            }

            @Override
            public void onFail(String error) {
                if (mView!=null)
                mView.showToast(error);
                mView.onFail(error);

            }
        });

    }
    public void requestEditInfo_Time() {
        model.requestEditInfo_time(new ResultCallBack<List<String>>() {
            @Override
            public void onSuccess(List<String> TimeBean) {
                if (mView!=null)
                    mView.onTimeSuccess(TimeBean);

            }

            @Override
            public void onFail(String error) {
                if (mView!=null)
                mView.showToast(error);
                mView.onFail(error);

            }
        });

    }

    public void requestEditInfo_School2(String id) {
        model.requestEditInfo_school2(new ResultCallBack<InfoSchoolBean2>() {
            @Override
            public void onSuccess(InfoSchoolBean2 infoschoolBean2s) {
                if (mView != null)

                    mView.onSchoolSuccess2(infoschoolBean2s);

            }

            @Override
            public void onFail(String error) {
                if (mView != null)
                    mView.showToast(error);
                mView.onFail(error);

            }
        },id);
    }

    public void requestEditInfo_School3(String id, String id2) {
        model.requestEditInfo_school3(new ResultCallBack<List<InfoSchoolBean3>>() {
            @Override
            public void onSuccess(List<InfoSchoolBean3> infoschoolBean3s) {
                if (mView != null)
                    mView.onSchoolSuccess3(infoschoolBean3s);

            }

            @Override
            public void onFail(String error) {
                if (mView != null)
                    mView.showToast(error);
                mView.onFail(error);

            }
        },id,id2);
    }

    public void requestEditInfo_Submit(String id1, String id2, String id3, String time) {
        model.requestEditInfo_submit(new ResultCallBack<Void>() {
            @Override
            public void onSuccess(Void voiddata) {
                if (mView != null)
                    mView.onSubmit(voiddata);
            }

            @Override
            public void onFail(String error) {
                if (mView != null)
                    mView.showToast(error);
                mView.onFail(error);

            }
        },id1,id2,id3,time);
    }
}
